
public class ChessMetric {

	public static void main(String[] args) {
		int size = 100;
		int[] start = {0,0};
		int[] end = {0,99};
		int num = 50;
		
		System.out.println(howMany(size,start,end,num));

	}
	

	public static long howMany(int size, int[] start, int[] end, int numMoves){
		long[][][] moves = new long[size][size][numMoves+1];
		
		int[][] position = {{-2,-1},{-2,1},{-1,-2},{-1,-1},{-1,0},{-1,1},{-1,2},{0,-1},{0,1},{1,-2},{1,-1},{1,0},{1,1},{1,2},{2,-1},{2,1}};
		moves[start[0]][start[1]][0]=1;
		
		for(int k=1;k<=numMoves;k++){
			for(int i=0;i<size;i++){
				for(int j=0;j<size;j++){
					for(int m=0;m<position.length;m++){
						int new_x = i+position[m][0];
						int new_y = j+position[m][1];
						if(new_x>=0 && new_x<size && new_y>=0 && new_y<size&&k>0){
							//System.out.println(m+" "+i+" "+j+" "+new_x+" "+new_y+" "+k+": "+moves[i][j][k-1]);
							moves[new_x][new_y][k]+=moves[i][j][k-1];
						}
					}
				}
			}
		}
		return moves[end[0]][end[1]][numMoves];
	}
		
}
